package com.ltsznh.android.locationreporting.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by 涛 on 2014/12/12.
 */
public class Tools {
    private static final SimpleDateFormat simpleIdFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    private static final SimpleDateFormat simpleTimeFormat = new SimpleDateFormat("HH:mm:ss");

    public static String getId() {
        return simpleIdFormat.format(new Date()) + "" + (int) ((Math.random() + 1) * 100000);
    }

    public static String getId(Calendar calendar) {
        return simpleIdFormat.format(calendar.getTime()) + "" + (int) ((Math.random() + 1) * 100000);
    }

    public static SimpleDateFormat getDateFormat() {
        return simpleDateFormat;
    }

    public static SimpleDateFormat getTimeFormat() {
        return simpleTimeFormat;
    }
}
